<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListOrgaoEstacaoTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:form  prependId="false" id="form" styleClass="jsfcrud_list_form"> 
                <p:growl id="messages" life="3000"/>


                <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="list"/>
                </h:panelGroup>

                <h:panelGroup >
                    <p:dataTable value="#{orgaoEstacaoController.lista}" var="item"  paginator="true" rows="10"
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                 rowsPerPageTemplate="5,10,15,20" rowKey="#{item.oesId}" paginatorPosition="both" emptyMessage="#{bundle.ListOrgaoEstacaoEmpty}" selection="#{orgaoEstacaoController.selectedOrgaoEstacao}" selectionMode="single">

                        <p:column styleClass="firstColumn" filterBy="#{item.oesId}" sortBy="#{item.oesId}">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListOrgaoEstacaoTitle_oesId}"/>
                            </f:facet>
                            <h:outputText value="#{item.oesId}"/>
                        </p:column>
                        <p:column filterBy="#{item.oesOrgId.orgNm}" filterMatchMode="contains" sortBy="#{item.oesOrgId.orgNm}">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListOrgaoEstacaoTitle_oesOrgId}"/>
                            </f:facet>
                            <h:outputText value="#{item.oesOrgId.orgNm}"/>
                        </p:column>
                        <p:column filterBy="#{item.oesEstId.estNm}" filterMatchMode="contains" sortBy="#{item.oesEstId.estNm}">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListOrgaoEstacaoTitle_oesEstId}"/>
                            </f:facet>
                            <h:outputText value="#{item.oesEstId.estNm}"/>
                        </p:column>

                        <f:facet name="footer">                                    
                            <p:commandButton id="createCommand" ajax="false" icon="ui-icon-document" action="#{orgaoEstacaoController.prepareCreate}" value="#{bundle.ListOrgaoEstacaoCreateLink}"/>
                            <p:commandButton id="viewCommand" value="#{bundle.MsgVisualizar}" icon="ui-icon-search"  update=":formList:displayView" oncomplete="orgaoEstacaoDialogView.show()" />
                            <p:commandButton id="editCommand" ajax="false" action="#{orgaoEstacaoController.prepareEdit}" value="#{bundle.ViewOrgaoEstacaoEditLink}" icon="ui-icon-pencil" />
                            <p:commandButton id="deleteCommand"  onclick="confirmationDestroy.show()" value="#{bundle.ViewOrgaoEstacaoDestroyLink}" type="button" icon="ui-icon-trash" />

                        </f:facet>

                    </p:dataTable>

                    <p:confirmDialog id="confirmDestroy" message="#{bundle.MsgConfirmDestroy_message}" header="#{bundle.MsgConfirmDestroy_header}" severity="alert" widgetVar="confirmationDestroy">
                        <p:commandButton id="confirm" ajax="false" value="#{bundle.MsgDialog_confirmar}"  oncomplete="confirmationDestroy.hide();" actionListener="#{orgaoEstacaoController.destroy}" />
                        <p:commandButton id="decline"  value="#{bundle.MsgDialog_cancelar}" update="messages" onclick="confirmationDestroy.hide()" type="button"/>

                    </p:confirmDialog>

                    <p:dialog id="dialogView" header="#{bundle.OrgaoEstacaoDialogView_header}" widgetVar="orgaoEstacaoDialogView" resizable="false" width="500" >

                        <h:panelGrid id="displayView" columns="2" cellpadding="4">                          

                            <h:outputText value="#{bundle.ViewOrgaoEstacaoLabel_oesId}"/>
                            <h:outputText value="#{orgaoEstacaoController.selected.oesId}" title="#{bundle.ViewOrgaoEstacaoTitle_oesId}"/>
                            <h:outputText value="#{bundle.ViewOrgaoEstacaoLabel_oesOrgId}"/>
                            <h:outputText value="#{orgaoEstacaoController.selected.oesOrgId.orgNm}" title="#{bundle.ViewOrgaoEstacaoTitle_oesOrgId}"/>
                            <h:outputText value="#{bundle.ViewOrgaoEstacaoLabel_oesEstId}"/>
                            <h:outputText value="#{orgaoEstacaoController.selected.oesEstId.estNm}" title="#{bundle.ViewOrgaoEstacaoTitle_oesEstId}"/>                
                        </h:panelGrid>
                    </p:dialog>
                </h:panelGroup>                          

            </h:form>
        </ui:define>
    </ui:composition>

</html>
